﻿namespace ZyGame.Avatar
{
    using ZyGame;
    using ZyGame.Avatar;
    using System;
    using System.Collections.Generic;
    using System.Xml.Linq;


    /// <summary>
    /// Avatar数据
    /// </summary>
    public sealed class AvatarConfig
    {
        public string name;
        public string group;
        public string icon;
        public string md5;
        public List<ElementData> items;

        public AvatarConfig()
        {
            items = new List<ElementData>();
        }

        public void Dispose()
        {
            Clear();
        }

        public void AddConfig(ElementData config)
        {
            this.items.Add(config);
        }

        public void RemoveConfig(ElementData config)
        {
            this.items.Remove(config);
        }

        public void Clear()
        {
            items.Clear();
        }
    }

    /// <summary>
    /// 部位数据
    /// </summary>
    public sealed class ElementData
    {
        /// <summary>
        /// 使用部件ID
        /// </summary>
        public string id;

        /// <summary>
        /// 部件使用的模型资源
        /// </summary>
        public string model;

        /// <summary>
        /// 部位
        /// </summary>
        public Element element;

        /// <summary>
        /// 部位使用的贴图
        /// </summary>
        public string texture;

        /// <summary>
        /// 部位Icon
        /// </summary>
        public string icon;

        /// <summary>
        /// 部位名称
        /// </summary>
        public string name;

        /// <summary>
        /// 分组名
        /// </summary>
        public string model_name;

        /// <summary>
        /// 发布状态
        /// </summary>
        public int publish_status;

        /// <summary>
        /// 一个整数版本号，增加这个数字可以迫使Unity重新下载缓存的资产捆绑包
        /// </summary>
        public uint version;

        /// <summary>
        /// 如果非零，则此数字将与下载资产的校验和进行比较 捆绑数据。如果CRC不匹配，将记录一个错误，并且资产 将不会加载捆绑包。如果设置为零，将跳过CRC检查。
        /// </summary>
        public uint crc;
    }
}